package com.hualan.web.wsj;

import com.hualan.pojo.wsj.GongYi;
import com.hualan.service.service.service.wsj.GongYiService;
import com.hualan.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/gongyi")
public class GongYiController {
    @Autowired(required=false)
    private GongYiService gongYiService;

    @RequestMapping("/listAll")
    public ResultEntity listAll(){
        //获取所有公益数据
        List<GongYi> gongYiList = gongYiService.listAll();
//        筛选，del为0时返回，为1不返回
        List<GongYi> gongYiList1=new ArrayList<GongYi>();

        for (GongYi gongYi:gongYiList){
            if (gongYi.getDel()==0){
                gongYiList1.add(gongYi);
            }
        }
        return ResultEntity.ok(gongYiList1);
    }
}